package entity;

import java.util.Objects;

/**
 * @author 李栋
 * @version 1.0.0
 * @className Shop.java
 * @createTime 2021年07月18日 21:48:00
 */
public class Shop implements Comparable<Shop> {

    private String shopName;
    private String shopCode;

    public Shop() {
    }

    public Shop(String s, String test1) {
        shopName = test1;
        shopCode = s;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public String getShopCode() {
        return shopCode;
    }

    public void setShopCode(String shopCode) {
        this.shopCode = shopCode;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (Objects.isNull(object) || getClass() != object.getClass()) return false;
        Shop shop = (Shop) object;
        return shopCode.equals(shop.getShopCode());
    }

    @Override
    public int hashCode() {
        return Objects.isNull(shopCode) ? 0 : shopCode.hashCode();
    }


    @Override
    public int compareTo(Shop shop) {
        int length = shop.getShopName().length();
        return this.shopName.length() - length;
    }
}
